<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!doctype html>
<html>
	<head>
		<base href="<%=basePath%>" />
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="renderer" content="webkit">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<link rel="stylesheet" href="layui/css/layui.css" media="all"> <!-- 适应所有设备 -->
		<style type="text/css">
		</style>
	</head>
	<% String nowDay = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); %>
	<body>
	    <form class="layui-form" onsubmit='return false'>
	      <div class="layui-form-item">
	        <div class="layui-inline">
	          <label class="layui-form-label">被赠送账户</label>
	          <div class="layui-input-inline">
		       <input type="text" name="DestUserId" id="DestUserId" required="" lay-verify="required"  autocomplete="off" class="layui-input">
		     </div>
	        </div>
	      </div>
	      <div class="layui-form-item">
	        <div class="layui-inline">
	          <label class="layui-form-label">赠送物品</label>
	          <div class="layui-input-inline">
	            <select name="Item" id="Item" disabled="disabled">
		         <option value="金币">金币</option>
		       </select>
	          </div>
	        </div>
	      </div>
	      <div class="layui-form-item">
	        <div class="layui-inline">
	          <label class="layui-form-label">赠送数量</label>
	          <div class="layui-input-inline">
	          <input type="number" name="ItemCount" id="ItemCount" required="" lay-verify="required"  autocomplete="off" class="layui-input" min="0" >
	          </div>
	        </div>
	      </div>
	      <div class="layui-form-item">
	        <div class="layui-inline">
              <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="sendResource">确认赠送</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
              </div>
            </div>
        </div>
	  </form>
	    
	    <script src="js/jquery.min.js"></script>
		<script src="layui/layui.js"></script>
		<script src="js/personal/GameItemString.js"></script>
		<script>
		    layui.use(['layer','form','table'],function(){
		    	var layer = layui.layer,
		    	    form  = layui.form,
		    	    table = layui.table;
		    	
		    	form.on('submit(sendResource)', function () {
		    		let BankItemSend = new Object();
		    		let ItemString = GameItemString($("#Item").val()).split(",");
		    		BankItemSend.DestUserId = $("#DestUserId").val(),
		    		BankItemSend.ItemCount = $("#ItemCount").val(),
		    		BankItemSend.ItemId = ItemString[0],
		    		BankItemSend.ItemSubId = ItemString[1],
		    		$.ajax({
		    			type : 'POST',
		    			url : 'recharge/upperLowerScore',
		    			async : true,
		    			dataType:'json',
		    			contentType : 'application/json',
		    			data : JSON.stringify(BankItemSend),
		    			success : function(resp) {
		    				if(resp.message === null)
		    					layer.msg("操作成功",{icon:6});
		    				else 
		    					layer.msg(resp.message,{icon:6});
		    			}
		    		});
		    	});
		    	
		    });
		</script>
    </body>
</html>